<template>
	<view>
		<view class="cu-timeline">
			<view class="cu-time">工单明细</view>
			<view class="cu-item " v-for="(item,index) in staffs" :key="key">
				<view class="bg-cyan content">
					<text>{{item.startTime}} </text> 到达 {{item.staffName}} 处
				</view>
				<view class="bg-cyan content" v-if="item.endTime != undefined">
					<text>{{item.endTime}} </text>  {{item.stateName}}
				</view>
				<view class="bg-cyan content" v-if="item.endTime != undefined">
					<text>处理意见：</text>  {{item.context}}
				</view>

			</view>
		</view>
		<viewImage ref="viewImageRef"></viewImage>
	</view>
</template>

<script>
	import {
		getAreaId
	} from '../../api/area/areaApi.js'
	import {
		queryGovReportUsers
	} from '../../api/reportInfo/reportInfoApi.js'
	import viewImage from '@/components/view-image/view-image.vue'
	import conf from '../../conf/config.js'
	export default {
		data() {
			return {
				viewImage: false,
				viewImageSrc: '',
				staffs:[],
				reportId:'',
				caId:'',
				imgUrlPre: '',
			}
		},
		components: {
			viewImage
		},
		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad: function(options) {
			let that = this;
			this.vc.onLoad(options);
			this.reportId = options.reportId;
			this.caId = getAreaId();
			this.imgUrlPre = conf.commonBaseUrl;
			
			//加载报修类型
			this._loadRepairStaffs();
		},
		methods: {
			_loadRepairStaffs:function(){
				let _that =this;
				let dataObj = {
					page: 1,
					row: 50,
					caId: getAreaId(),
					reportId: this.reportId
				};
				queryGovReportUsers(dataObj).then(_data =>{
					let _json = _data;
					if (_json.code == 0) {
						_that.staffs = _json.data;
						console.log(_that.staffs)
					}
				})
			},
			preview: function(e) {
				let _url = e.target.dataset.url;
				this.$refs.viewImageRef.showThis(_url);
			}
		}
	}
</script>
<style>
	.repair-img-item{
		display: inline-block;
		margin: 0 20upx;
	}
	.repair-img-item image{
		width: 200upx;
		border-radius: 15upx;
	}
</style>

